///**
// * <p>
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// * <p>
// * http://www.apache.org/licenses/LICENSE-2.0
// * <p>
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
//package com.qqhf.common.listener;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//import javax.servlet.ServletContext;
//import javax.servlet.ServletContextEvent;
//import javax.servlet.ServletContextListener;
//import java.util.HashMap;
//import java.util.Map;
//
///**
// *
// */
//public class ConfigListener implements ServletContextListener {
//
//    private Logger logger = LoggerFactory.getLogger(ConfigListener.class);
//    private static Map<String, String> conf = new HashMap<>();
//
//    public static Map<String, String> getConf() {
//        return conf;
//    }
//
//    /**
//     * 当Servlet容器终止Web应用时调用该方法。在调用该方法之前，容器会先销毁所有的Servlet和Filter过滤器。
//     */
//    @Override
//    public void contextDestroyed(ServletContextEvent arg0) {
//        conf.clear();
//    }
//
//    /**
//     * 当Servlet容器启动Web应用时调用该方法。在调用完该方法之后，容器再对Filter初始化，
//     * 并且对那些在Web应用启动时就需要被初始化的Servlet进行初始化。
//     */
//    @Override
//    public void contextInitialized(ServletContextEvent evt) {
//        ServletContext sc = evt.getServletContext();
//        // 项目路径
//        conf.put("realPath", sc.getRealPath("/").replaceFirst("/", ""));
//        conf.put("contextPath", sc.getContextPath());
//
//        // 测试
//        String realPath = conf.get("realPath");
//        String contextPath = conf.get("contextPath");
//        String s = "--------------运行ConfigListener--------------\n"
//                + "-----   realPath    :" + realPath + "--------------"
//                + "-----   contextPath :" + realPath + "--------------";
//        logger.info(s);
//    }
//
//}
